package org.wishwork.api.allocate;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.wishwork.api.allocate.query.AllocateQueryApi;
import org.wishwork.api.allocate.query.AllocateQueryRequest;
import org.wishwork.api.allocate.query.response.AllocateQueryResponse;
import org.wishwork.api.allocate.upload.in.AllocateInUploadApi;
import org.wishwork.api.allocate.upload.in.AllocateInUploadResponse;
import org.wishwork.api.allocate.upload.in.request.AllocateInUploadRequest;
import org.wishwork.api.allocate.upload.kc.AllocateKcUploadApi;
import org.wishwork.api.allocate.upload.kc.AllocateKcUploadRequest;
import org.wishwork.api.allocate.upload.kc.AllocateKcUploadResponse;
import org.wishwork.context.Context;

import java.util.List;

/**
 * @description: 调拨Api
 * @author: WangYX
 * @create: 2022-04-12 21:15
 * @Version: 1.0.0
 **/

public class AllocateApi {

    private static final Logger log = LoggerFactory.getLogger(AllocateApi.class);

    private Context context;

    private final AllocateQueryApi allocateQueryApi;

    private final AllocateInUploadApi allocateInUploadApi;

    private final AllocateKcUploadApi allocateKcUploadApi;

    public AllocateApi(Context context) {
        this.context = context;
        this.allocateQueryApi = new AllocateQueryApi(context);
        this.allocateInUploadApi = new AllocateInUploadApi(context);
        this.allocateKcUploadApi = new AllocateKcUploadApi(context);
    }

    /**
     * 调拨单查询
     *
     * @param allocateQueryRequest
     * @return
     * @throws Exception
     */
    public List<AllocateQueryResponse> query(AllocateQueryRequest allocateQueryRequest) throws Exception {
        return this.allocateQueryApi.business(allocateQueryRequest);
    }

    /**
     * 库存调拨上传（仓内调拨）
     *
     * @param allocateInUploadRequest
     * @return
     * @throws Exception
     */
    public List<AllocateInUploadResponse> inUpload(AllocateInUploadRequest allocateInUploadRequest) throws Exception {
        return this.allocateInUploadApi.business(allocateInUploadRequest);
    }

    /**
     * 库存调拨上传（跨仓调拨）
     *
     * @param allocateKcUploadRequest
     * @return
     * @throws Exception
     */
    public List<AllocateKcUploadResponse> kcUpload(AllocateKcUploadRequest allocateKcUploadRequest) throws Exception {
        return this.allocateKcUploadApi.business(allocateKcUploadRequest);
    }

}
